package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 交易类型（1-充值补贴金，2-开通会员，3-购买次卡）
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum BankPayTradeTypeEnum {

    RECHARGE_SUBSIDY(1, "充值补贴金"),
    MERCHANT_FEE(2, "开通会员"),
    MERCHANT_CARD(3, "购买次卡"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    BankPayTradeTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static BankPayTradeTypeEnum typeOf(Integer value) {
        BankPayTradeTypeEnum[] values = BankPayTradeTypeEnum.values();
        for (BankPayTradeTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static BankPayTradeTypeEnum typeOf(String name) {
        BankPayTradeTypeEnum[] values = BankPayTradeTypeEnum.values();
        for (BankPayTradeTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
